home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 August / Chip_2000-08_cd1.bin / sharewar / dzperl / Setup.exe / {app} / Samples / time.pl < prev   
Encoding:
Perl Script  |  2000-06-15  |  1.0 KB  |  30 lines

  1. #!/usr/bin/perl
  2.  
  3. $timeoffset = 0; # Time offset - change it's value if your server time
  4.                  # conflicts with your local time.
  5.  
  6. # You wil get "possible typo" warning if you won't use all the variables.
  7. # Please insert "undef" instead of unused variables when you upload the
  8. # script to web server.
  9. ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time + (3600*$timeoffset));
  10.  
  11. # Hours, minutes, seconds, day and month should be in two-digit format.
  12. $hour = "0$hour" if ($hour < 10);
  13. $min  = "0$min" if ($min < 10);
  14. $sec  = "0$sec" if ($sec < 10);
  15. $mday = "0$mday" if ($mday < 10);
  16. $mon  = "0$mon" if ($mon < 10);
  17.  
  18. # Y2K!
  19. $year = 2000 + ($year - 100);
  20.  
  21. # Send the MIME HTTP header
  22. print "Content-type: text/html\n\n";
  23.  
  24. # Compose the output from the variables defined in the line 9. Feel free to
  25. # change it.       [DD.MM.YYYY]
  26. print "<h1>$mday.$mon.$year $hour:$min:$sec</h1>\n";
  27.  
  28. # Hint: you may call this script by SSI using this tag:
  29. # <!--#exec cgi="/cgi-bin/time.pl"-->
  30.